package project.interactive_face;

import javax.swing.*;
import java.awt.*;

public class Interactive_login{
    Interactive_register ir = new Interactive_register();
    Interactive_webcam_open iwo = new Interactive_webcam_open();
    Interactive_webcam_append iwa = new Interactive_webcam_append();

    JFrame jf = new JFrame("登录界面");
    JPanel p1 = new JPanel();   //user
    JPanel p2 = new JPanel();   //password
    JPanel p3 = new JPanel();   //put_buttons（login/register）
    JButton login = new JButton("登 录");
    JButton register = new JButton("注 册");
    JButton shoot = new JButton("人脸扫描登录");
    JTextField user = new JTextField(18);
    JPasswordField password = new JPasswordField(18);
    JLabel user1 = new JLabel(" 用 户:");
    JLabel password1 = new JLabel(" 密 码:");
    Box b = Box.createVerticalBox();

    public void init() {
        ir.registerInit();
        iwa.webcamInit();
        iwo.webcamInit();
        //交互界面组件的位置及细节设置
        p3.setLayout(new FlowLayout(FlowLayout.CENTER));
        jf.setLocation(600,150);
        login.setFocusPainted(false);
        register.setFocusPainted(false);

        //组件安装
        p1.add(user1);
        p1.add(user);
        p2.add(password1);
        p2.add(password);
        p3.add(login);
        p3.add(shoot);
        p3.add(register);
        b.add(p1);
        b.add(p2);
        b.add(p3);
        jf.setContentPane(b);

        //用户交互界面固定参数设置
        jf.pack();
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setResizable(false);
        jf.setVisible(true);
    }
}
